package com.hp.mvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 自定义控制器
 */
@Controller
@RequestMapping("mvc")
public class HelloController {

    /**
     * 请求映射 http://localhost:8080/mvc/hello ---> /WEB-INF/pages/index.jsp
     * @return
     */
//    @RequestMapping("hello")
//    @RequestMapping(value = "hello",method = RequestMethod.GET)
    @GetMapping("hello")
    public String index(){
        return "index";
    }

    //访问login.jsp页面
    @RequestMapping("login")
    public String toLogin(){
        System.out.println("toLogin");
        return "login";
    }

    @GetMapping("success")
    public String toSuccess(){
        System.out.println("toSuccess");
        return "success";
    }

    @GetMapping("saveStudent")
    public String toSaveStudent(){
        return "saveStudent";
    }
}
